package com.cn.wanxi.service;

import com.cn.wanxi.dao.NavDao;
import com.cn.wanxi.model.NavModel;

import java.util.ArrayList;
import java.util.List;

public class NavService   {
    public List<NavModel> getNavModelList() {
        List<NavModel> list = new ArrayList<>();
//        for (int i = 0; i <list.size() ; i++) {
//            if(i!=2){
//                System.out.println(list.get(i).getTitle());
//            }
//        }
        NavDao navDao = new NavDao();
//        NavModel navModel = new NavModel();
//        navModel.setTitle("1");
//        navModel.setHref("1");
//        NavModel navModel1 = new NavModel();
//        navModel1.setTitle("2");
//        navModel1.setHref("2");
//        navDao.setHrefs();
        int length = navDao.getHrefs().size();//计算集合的长度
        for (int i = 0; i < length; i++) {
            NavModel navModel = new NavModel();
            navModel.setTitle(navDao.getTitles()[i]);
            navModel.setHref(navDao.getHrefs().get(i));
            list.add(navModel);
        }
        return list;
    }

    public static void main(String[] args) {
        new NavService().getNavModelList();
    }
}
